<%-- 以图片列表形式显示作品，八宫格显示，不足8个显示占位符  --%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>

<!-- 作品列表 八宫格  begin  -->

<%@page import="java.util.List"%>
<%@page import="com.compty.core.page.Page"%>
<%@page import="com.compty.paint.domain.Painting"%>

<div style="width: 958px;border: 1px solid #ccc;margin: 0 auto;padding-bottom:10px;overflow: hidden;background: #fff">
<div style="font-family: 宋体;font-size: 12px;text-align: right;padding-top: 10px;padding-right: 30px;"><a href="javascript:showNextPagePic(-1)">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:showNextPagePic(1)">下一页</a></div>
<div>
<%
	Page p = (Page)request.getAttribute("page"); 
	int len = 0;
	if( p != null ){
		List list = (List)p.getResult();
		len = list.size();
	}
	
	for(int i = 1 ; i <= 8 ;i++){
		if(i % 4 == 1){
%>
<div style="clear: both;padding-left: 22px;">
<%}
		if(i <= len ){
			List list = (List)p.getResult();
			Painting painting = (Painting)list.get(i-1);
			int margin_right = 0;
			if( i % 4 > 0 ){
				margin_right = 24;
			}
		%>
	 	<div style="background: url('../images/wkA.gif');float: left;width: 210px;height: 250px;margin-top: 15px;margin-right: <%=margin_right %>px;">
			      <div style="background: url('<%=painting.getMiddleImageApath() %>') center center;position: relative;width: 185px;height: 225px;margin-top: 12px;margin-left: 12px;">
                   	<a style="display:block;width: 185px;height: 225px;" href="${ctx}/front/backgroundAction!showDetail.do?id=<%=painting.getId() %>" target="_blank"></a>
                  </div>
        </div>
 <%}
  else{ 
	 if(i % 4 == 0 ){%> <%-- 占位符  一行末尾  --%>
		<div style="background: url('../images/wkA.gif');float: left;width: 210px;height: 250px;line-height:250px;text-align: center;margin-top: 15px;">
			   <a name="addPaintingHref" style="font-size: 14px;font-family:宋体;color: red;cursor: pointer;">添加作品</a>
		</div>
<%}else{ %> <%-- 占位符  非一行末尾  --%>
		<div style="background: url('../images/wkA.gif');float: left;width: 210px;height: 250px;line-height:250px;margin-right: 24px;text-align: center;margin-top: 15px;">
				  <a name="addPaintingHref" style="font-size: 14px;font-family:宋体;color: red;cursor: pointer;">添加作品</a>
		</div>
 <%}
} %>
<% if( i % 4 == 0){ %>
</div>
<%} %>
<%		
}
%>
</div>
<div style="clear: both;font-family: 宋体;font-size: 12px;text-align: right;padding-top: 5px;padding-right: 30px;"><a href="javascript:showNextPagePic(-1)">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:showNextPagePic(1)">下一页</a></div>
<!-- 隐藏域 begin  -->
	<input type="hidden" value="<s:property value="page.pageCount" />" name="totalPages_Hidden" id="totalPages_Hidden" />
	<input type="hidden" value="<s:property value="page.pageNo" />" name="curPage" id="curPage" />
<!-- 隐藏域  end  -->		
</div>
<!-- 作品列表 八宫格  end  -->